/*
 * Ch5.6
 */
class SwapOddEvenBits{
	public SwapOddEvenBits(){
		
	}
	
 	private static int swapOEBits(int i){
	//1010 1010 1010 1010: even mask
	int evenToOdd = (i & 0xAAAAAAAA ) >> 1;
	//0101 0101 0101 0101: odd mask
	int oddToEven = (i & 0x55555555) << 1;
	
	return evenToOdd | oddToEven;	
	}
	public static void main(String[] args){
		System.out.println(swapOEBits(128));
	}
}